<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>过滤器+日期</title>
    <script type="text/javascript" src="https://unpkg.com/vue/dist/vue.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment-with-locales.js"></script>
</head>
<body>

<div id="app">
    <!--La prise de la Bastille, survenue le {{bastilleStormingDate | date}}-->
    La prise de la Bastille, survenue le {{bastilleStormingDate | date('fr')}}
</div>

<script>
//    Vue.filter('date', function (date) {
//        moment.locale('fr'); //设置语言为法语
//        return moment(date).format('LL');
//    })
    Vue.filter('date', function (date, locale) {
        moment.locale(locale);
        return moment(date).format('LL');
    })


    new Vue({
        el: '#app',
        data: {
            bastilleStormingDate: '1789-07-14 h'
        }
    })

</script>

</body>
</html>